package com.bwie.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bwie.pojo.Brand;
import com.bwie.pojo.CategoryBrand;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author 段阳
 * @version 1.0
 * Create by 2024/4/23 20:05
 */
@Mapper
public interface BrandMapper extends BaseMapper<Brand> {




    @Insert("INSERT INTO tb_category_brand(category_id,brand_id) VALUES(#{cid},#{id})")
    void addNewBrand(Long cid, Long id);

    @Select("select category_id,brand_id from tb_category_brand where brand_id = #{id}")
    List<CategoryBrand> selectType(Long id);

    @Select("select category_id,brand_id from tb_category_brand where category_id = #{id}")
    List<CategoryBrand> selectCategory(Long id);

    @Delete("delete from tb_category_brand where brand_id = #{id}")
    Integer deleteCategory(Long id);
}